package com.zz.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Update;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 用户对应角色信息
 * @author zhouzi
 */
@Data
@ApiModel("用户对应角色信息")
public class UserRole implements Serializable {
    private static final long serialVersionUID = 1L;

    //编号
    @ApiModelProperty("编号")
    @TableId(type= IdType.AUTO)//主键自增
    @NotNull(message = "用户角色表主键不能为空")
    private Integer id;

    //用户id
    @ApiModelProperty("用户id")
    @NotNull(message = "用户学号不能为空", groups = {Insert.class, Delete.class})
    @Range(min = 1000000000, message = "用户学号为10位", groups = {Insert.class, Delete.class})
    private Integer userId;

    //角色id
    @ApiModelProperty("角色id")
    @NotNull(message = "角色id不能为空", groups = {Insert.class, Delete.class})
    private Integer roleId;

}
